﻿Imports System.ComponentModel
Imports IICBusinessLogic

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class ucClassMemberDetails
    Inherits UcBaseEditControl
    Implements IUcEditControl

#Region "Designer"
    'UserControl overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Attend As org.codegen.win.controls.CGCheckBox
    Friend WithEvents Attendlbl As System.Windows.Forms.Label

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.ClassIdlbl = New System.Windows.Forms.Label()
        Me.ClassDescription = New org.codegen.win.controls.CGTextBox(Me.components)
        Me.StudentIdlbl = New System.Windows.Forms.Label()
        Me.StudentFullName = New org.codegen.win.controls.CGTextBox(Me.components)
        Me.CandidateCodelbl = New System.Windows.Forms.Label()
        Me.CandidateCode = New org.codegen.win.controls.CGTextBox(Me.components)
        Me.Gradelbl = New System.Windows.Forms.Label()
        Me.Grade = New org.codegen.win.controls.CGIntTextBox(Me.components)
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Attend = New org.codegen.win.controls.CGCheckBox(Me.components)
        Me.Attendlbl = New System.Windows.Forms.Label()
        CType(Me.ErrProvider, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'ClassIdlbl
        '
        Me.ClassIdlbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ClassIdlbl.Location = New System.Drawing.Point(6, 15)
        Me.ClassIdlbl.Name = "ClassIdlbl"
        Me.ClassIdlbl.Size = New System.Drawing.Size(86, 20)
        Me.ClassIdlbl.TabIndex = 0
        Me.ClassIdlbl.Text = "Class"
        Me.ClassIdlbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'ClassId
        '
        Me.ClassDescription.AssociatedLabel = Me.ClassIdlbl
        Me.ClassDescription.BackColor = System.Drawing.Color.LightYellow
        Me.ClassDescription.ErrProvider = Nothing
        Me.ClassDescription.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ClassDescription.isMandatory = True
        Me.ClassDescription.Location = New System.Drawing.Point(102, 15)
        Me.ClassDescription.MaxLength = 255
        Me.ClassDescription.MaxValue = Nothing
        Me.ClassDescription.MinValue = Nothing
        Me.ClassDescription.Name = "ClassId"
        Me.ClassDescription.ReadOnly = True
        Me.ClassDescription.showAsteriskForMandatory = True
        Me.ClassDescription.Size = New System.Drawing.Size(544, 21)
        Me.ClassDescription.TabIndex = 1
        Me.ClassDescription.TabStop = False
        '
        'StudentIdlbl
        '
        Me.StudentIdlbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.StudentIdlbl.Location = New System.Drawing.Point(6, 45)
        Me.StudentIdlbl.Name = "StudentIdlbl"
        Me.StudentIdlbl.Size = New System.Drawing.Size(86, 20)
        Me.StudentIdlbl.TabIndex = 2
        Me.StudentIdlbl.Text = "Student"
        Me.StudentIdlbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'StudentId
        '
        Me.StudentFullName.AssociatedLabel = Me.StudentIdlbl
        Me.StudentFullName.BackColor = System.Drawing.Color.LightYellow
        Me.StudentFullName.ErrProvider = Nothing
        Me.StudentFullName.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.StudentFullName.isMandatory = True
        Me.StudentFullName.Location = New System.Drawing.Point(102, 45)
        Me.StudentFullName.MaxLength = 255
        Me.StudentFullName.MaxValue = Nothing
        Me.StudentFullName.MinValue = Nothing
        Me.StudentFullName.Name = "StudentId"
        Me.StudentFullName.ReadOnly = True
        Me.StudentFullName.showAsteriskForMandatory = True
        Me.StudentFullName.Size = New System.Drawing.Size(544, 21)
        Me.StudentFullName.TabIndex = 3
        Me.StudentFullName.TabStop = False
        '
        'CandidateCodelbl
        '
        Me.CandidateCodelbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.CandidateCodelbl.Location = New System.Drawing.Point(6, 75)
        Me.CandidateCodelbl.Name = "CandidateCodelbl"
        Me.CandidateCodelbl.Size = New System.Drawing.Size(86, 20)
        Me.CandidateCodelbl.TabIndex = 4
        Me.CandidateCodelbl.Text = "Candidate Code"
        Me.CandidateCodelbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'CandidateCode
        '
        Me.CandidateCode.AssociatedLabel = Me.CandidateCodelbl
        Me.CandidateCode.BackColor = System.Drawing.SystemColors.ButtonFace
        Me.CandidateCode.ErrProvider = Nothing
        Me.CandidateCode.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.CandidateCode.FormatPattern = Nothing
        Me.CandidateCode.isMandatory = True
        Me.CandidateCode.Location = New System.Drawing.Point(102, 75)
        Me.CandidateCode.MaxLength = 255
        Me.CandidateCode.MaxValue = Nothing
        Me.CandidateCode.MinValue = Nothing
        Me.CandidateCode.Name = "CandidateCode"
        Me.CandidateCode.ReadOnly = True
        Me.CandidateCode.showAsteriskForMandatory = True
        Me.CandidateCode.Size = New System.Drawing.Size(200, 21)
        Me.CandidateCode.TabIndex = 5
        Me.CandidateCode.TabStop = False
        '
        'Gradelbl
        '
        Me.Gradelbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Gradelbl.Location = New System.Drawing.Point(6, 102)
        Me.Gradelbl.Name = "Gradelbl"
        Me.Gradelbl.Size = New System.Drawing.Size(86, 20)
        Me.Gradelbl.TabIndex = 6
        Me.Gradelbl.Text = "Grade"
        Me.Gradelbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Grade
        '
        Me.Grade.AssociatedLabel = Me.Gradelbl
        Me.Grade.BackColor = System.Drawing.Color.Transparent
        Me.Grade.ErrProvider = Nothing
        Me.Grade.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Grade.FormatPattern = Nothing
        Me.Grade.isMandatory = False
        Me.Grade.Location = New System.Drawing.Point(102, 102)
        Me.Grade.MaxLength = 255
        Me.Grade.MaxValue = Nothing
        Me.Grade.MinValue = Nothing
        Me.Grade.Name = "Grade"
        Me.Grade.showAsteriskForMandatory = True
        Me.Grade.Size = New System.Drawing.Size(200, 21)
        Me.Grade.TabIndex = 7
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(128, 136)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(351, 13)
        Me.Label1.TabIndex = 10
        Me.Label1.Text = "Check if Student Will Attend Class.  Leave Empty if exam only registration"
        '
        'Attend
        '
        Me.Attend.AssociatedLabel = Me.Attendlbl
        Me.Attend.BackColor = System.Drawing.Color.Transparent
        Me.Attend.ErrProvider = Me.ErrProvider
        Me.Attend.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Attend.intValue = 0
        Me.Attend.isMandatory = False
        Me.Attend.Location = New System.Drawing.Point(105, 133)
        Me.Attend.MaxValue = Nothing
        Me.Attend.MinValue = Nothing
        Me.Attend.Name = "Attend"
        Me.Attend.ReadOnly = False
        Me.Attend.showAsteriskForMandatory = True
        Me.Attend.Size = New System.Drawing.Size(17, 20)
        Me.Attend.TabIndex = 9
        Me.Attend.Text = "false"
        Me.Attend.UseVisualStyleBackColor = False
        Me.Attend.value = False
        '
        'Attendlbl
        '
        Me.Attendlbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Attendlbl.Location = New System.Drawing.Point(25, 132)
        Me.Attendlbl.Name = "Attendlbl"
        Me.Attendlbl.Size = New System.Drawing.Size(70, 20)
        Me.Attendlbl.TabIndex = 8
        Me.Attendlbl.Text = "Attend"
        Me.Attendlbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'ucClassMemberDetails
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Attendlbl)
        Me.Controls.Add(Me.Attend)
        Me.Controls.Add(Me.ClassIdlbl)
        Me.Controls.Add(Me.ClassDescription)
        Me.Controls.Add(Me.StudentIdlbl)
        Me.Controls.Add(Me.StudentFullName)
        Me.Controls.Add(Me.CandidateCodelbl)
        Me.Controls.Add(Me.CandidateCode)
        Me.Controls.Add(Me.Gradelbl)
        Me.Controls.Add(Me.Grade)
        Me.Name = "ucClassMemberDetails"
        Me.Size = New System.Drawing.Size(996, 485)
        CType(Me.ErrProvider, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub



    Friend WithEvents ClassIdlbl As System.Windows.Forms.Label
    Friend WithEvents ClassDescription As CGTextBox
    Friend WithEvents StudentIdlbl As System.Windows.Forms.Label
    Friend WithEvents StudentFullName As CGTextBox
    Friend WithEvents CandidateCodelbl As System.Windows.Forms.Label
    Friend WithEvents CandidateCode As CGTextBox
    Friend WithEvents Gradelbl As System.Windows.Forms.Label
    Friend WithEvents Grade As CGIntTextBox


#End Region

#Region "Properties"

#End Region

#Region "Methods"

    Private classId As Integer
    Private studentId As Integer

    ''' <summary>
    ''' Fills the controls on the screen from data in the object
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub _loadData() Handles Me.evLoadObjectData

        Dim mo As ClassMember = DirectCast(Me.ModelObject(), ClassMember)

        Me.ClassDescription.value = mo.PeriodClass.ClassDescription
        Me.StudentFullName.value = mo.Student.StudentFullName
        Me.CandidateCode.value = mo.CandidateCode
        Me.Grade.value = mo.Grade
        Me.Attend.value = mo.Attend

        Me.Grade.MinValue = CStr(0)
        Me.Grade.MaxValue = CStr(mo.PeriodClass.Lesson.DefaultMaxGrade)

        Me.Grade.ReadOnly = Not mo.PeriodClass.Period.IsOpen.GetValueOrDefault
        Me.Grade.Focus()

    End Sub



    ''' <summary>
    ''' Loads the object from the database and then sets the proeperties 
    ''' of the object from values on the controls
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub _loadToObject() Handles Me.evLoadToObject

        Dim mo As ClassMember = DirectCast(Me.ModelObject, ClassMember)
        
        mo.setCandidateCode(Me.CandidateCode.Text)
        mo.setGrade(Me.Grade.Text)
        mo.Attend = Me.Attend.Checked

    End Sub



    Public Sub _InitializeControl() Handles Me.InitializeControl

        If Me.isInitialized = False Then
            'setup datasources here

          
            Me.isInitialized = True
        End If

    End Sub

    Private Sub ucClassMemberDetails_Validating(ByVal sender As Object, _
                                                ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.Validating

        If Me.Grade.integerValue.GetValueOrDefault > 0 Then
            Me.Attend.Checked = True

        End If

    End Sub

#End Region

End Class


